/*
 * LoginFrame.java
 *
 * Created on March 25, 2007, 8:39 PM
 */

package edu.byu.isys413.group1E.gui;

import edu.byu.isys413.group1E.ConnectionPoolException;
import edu.byu.isys413.group1E.DataException;
import edu.byu.isys413.group1E.data.*;
import java.sql.SQLException;
/** 
 *
 * @author  tkulbeth
 */
public class BackupPriceFrame extends javax.swing.JFrame {
    
    /**
     * Creates new form LoginFrame
     */
    public BackupPriceFrame() {
        initComponents();
        this.field_buPrice.setEditable(false);
        BackupServiceBO bs = null;
        try {
            bs = BackupServiceDAO.getInstance().read();
        } catch (DataException ex) {
            ex.printStackTrace();
        } catch (ConnectionPoolException ex) {
            ex.printStackTrace();
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
        this.field_buPrice.setText(Double.toString(bs.getCurBuPrice()));
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        jPanel2 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        button_okBuPrice = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        field_buPrice = new javax.swing.JTextField();

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );
        jButton1.setText("jButton1");
        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Login");
        setName("LoginFrame");
        setResizable(false);
        button_okBuPrice.setText("OK");
        button_okBuPrice.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                button_okBuPriceActionPerformed(evt);
            }
        });

        jPanel4.add(button_okBuPrice);

        getContentPane().add(jPanel4, java.awt.BorderLayout.SOUTH);

        jLabel3.setText("The Current Backup Price is:");
        getContentPane().add(jLabel3, java.awt.BorderLayout.NORTH);

        jPanel3.setLayout(new java.awt.GridLayout(1, 1, 3, 3));

        field_buPrice.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        field_buPrice.setText("<price>");
        jPanel3.add(field_buPrice);

        getContentPane().add(jPanel3, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void button_okBuPriceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button_okBuPriceActionPerformed
        this.setVisible(false);
        this.dispose();
    }//GEN-LAST:event_button_okBuPriceActionPerformed
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new LoginFrame().setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton button_okBuPrice;
    private javax.swing.JTextField field_buPrice;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    // End of variables declaration//GEN-END:variables
    
}
